/*
 * @Description:用户管理
 * @Author: 龙春雨
 * @Date: 2023-04-10 09:52:27
 */

import request from '@/router/axios';

export function fetchList(query) {
  return request({
    url: '/core/user/page',
    method: 'get',
    params: query,
  });
}

export function addObj(obj) {
  return request({
    url: '/core/user',
    method: 'post',
    data: obj,
  });
}

export function getObj(id) {
  return request({
    url: '/admin/user/' + id,
    method: 'get',
  });
}

export function delObj(id) {
  return request({
    url: '/core/user/' + id,
    method: 'delete',
  });
}

export function putObj(obj) {
  return request({
    url: '/core/user',
    method: 'put',
    data: obj,
  });
}

export function getDetails(obj) {
  return request({
    url: '/admin/user/details/' + obj,
    method: 'get',
  });
}

export function getDetailsByPhone(obj) {
  return request({
    url: '/admin/user/detailsByPhone/' + obj,
    method: 'get',
  });
}

// 更改个人信息
export function editInfo(obj) {
  return request({
    url: '/admin/user/edit',
    method: 'put',
    data: obj,
  });
}

// 通过userId查询所属公益站
export function getPublicWelfareStationByUserId(id) {
  return request({
    url: `/core/user/listBase/${id}`,
    method: 'get',
  });
}

// 获取客户模板
export function exportUserTemplate() {
  return request({
    url: `/app/appuser/template/export`,
    method: 'get',
  });
}

// 导出所有客户信息
export function exportUserData() {
  return request({
    url: `/app/appuser/export`,
    method: 'get',
  });
}
